import plugin from '../../../lib/plugins/plugin.js'
import { Config } from '../components/index.js'
import { common } from '../model/index.js'
export class FriendAdd extends plugin {
  constructor () {
    super({
      name: '小月好友请求',
      dsc: '加群请求',
      event: 'notice.friend.increase',
    })
  }

  async accept () {
  let qg = Config.xyss
  if (!qg.qg) return
	let config =  Config.xyqg
    let msg = ['接收到一个新的好友请求\n',
      segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${this.e.user_id}`),
      `QQ：${this.e.user_id}\n`,
      `昵称：${this.e.nickname}\n`,
    ]
  if (config.blackList.includes(this.e.user_id)) {
    await this.e.approve(false)
    msg.push(`状态：已拒绝`)
  } else if (config.whileList.includes(this.e.user_id)) {
    await this.e.approve(true)
    msg.push(`状态：已同意`)
  } else {
      msg.push(`状态：未处理`)
  }
    
    common.sendMasterMsg(msg)
  }
}